<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>CSS布局</title>
    <style type="text/css">
        *{
            margin: 0;
            padding:0;
        }
        .top{
            width:380px;
            height:240px;
        }
        .top img{
            width: 380px;
            height: 240px;
            z-index:0;
        }
        /*此处写代码*/
        .topplayer{
            top: 0px;
            position:absolute;
            background:black;
            width:380px;
            height:240px;
            opacity:0.5;
            z-index:1;
        }
    </style>
</head>
<body>
<div class="top">
    <img src="http://climg.mukewang.com/58f829ca00010be703840240.jpg">
</div>
<!-- 此处写代码 -->
<div class="topplayer"></div>
</body>
</html>
